#ifndef	__inccommon_h__
#define	__inccommon_h__

#include <string>
#include <vector>
#include <map>
#include <limits>
#include <algorithm>
#include <utility>
#include <cassert>
#include <cmath>
#include <iostream>

#define	NOMINMAX
#include <windows.h>

typedef std::string			rtString;

typedef signed char			int8;
typedef unsigned char		uint8;
typedef signed short		int16;
typedef unsigned short		uint16;
typedef signed int			int32;
typedef unsigned int		uint32;
typedef signed __int64		int64;
typedef unsigned __int64	uint64;
typedef double				real64;

#ifndef	NULL
#	define	NULL	0
#endif	// NULL

template <typename T>
inline void SafeDelete(T*& ptr)
{
	if (NULL != ptr)
		delete ptr;
	ptr = NULL;
}
template <typename T>
inline void SafeDeleteArray(T*& ptr)
{
	if (NULL != ptr)
		delete [] ptr;
	ptr = NULL;
}

static const int s_MaxTraceDepth = 6;

// _data/textures/floor.jpg ->
//							  _data/textures/
//							  floor.jpg
inline void SplitPathName(const rtString& path, rtString& pathDir, rtString& fileName)
{
	rtString::size_type slashPos = path.rfind('/');
	if (slashPos > 0)
	{
		slashPos += 1;
		pathDir = path.substr(0, slashPos);
		fileName = path.substr(slashPos);
	}
}

#endif	// __inccommon_h__
